home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programmierung
/
Power-Programmierung (Tewi)(1994).iso
/
magazine
/
pctchnqs
/
1992
/
number1
/
fileview.h
< prev
next >
Wrap
C/C++ Source or Header
|
1992-01-01
|
2KB
|
92 lines
/*---------------------------------------------------------*/
/* */
/* Turbo Vision 1.0 */
/* Copyright (c) 1991 by Borland International */
/* */
/* Fileview.h: Header file for fileview.cpp. */
/*---------------------------------------------------------*/
#if !defined( __FILEVIEW_H )
#define __FILEVIEW_H
#define Uses_TCollection
#define Uses_TScroller
#define Uses_TWindow
#include <tv.h>
const hlChangeDir = cmChangeDir;
class TLineCollection : public TCollection
{
public:
TLineCollection(short lim, short delta) : TCollection(lim, delta) {}
virtual void freeItem(void *p) { delete p; }
private:
virtual void *readItem( ipstream& ) { return 0; }
virtual void writeItem( void *, opstream& ) {}
};
class TFileViewer : public TScroller
{
public:
char *fileName;
TCollection *fileLines;
Boolean isValid;
TFileViewer( const TRect& bounds,
TScrollBar *aHScrollBar,
TScrollBar *aVScrollBar,
const char *aFileName
);
~TFileViewer();
TFileViewer( StreamableInit ) : TScroller(streamableInit) { };
void draw();
void readFile( const char *fName );
void setState( ushort aState, Boolean enable );
void scrollDraw();
Boolean valid( ushort command );
// PRFILE CHANGE: added handleEvent(TEvent&) and printFile() functions.
void handleEvent(TEvent& event);
void printFile();
private:
virtual const char *streamableName() const
{ return name; }
protected:
virtual void write( opstream& );
virtual void *read( ipstream& );
public:
static const char * const name;
static TStreamable *build();
// PRFILE CHANGE: added filesOpen member.
static int filesOpen;
};
class TFileWindow : public TWindow
{
public:
TFileWindow( const char *fileName );
};
const int maxLineLength = 256;
#endif